package com.tengju.data.domain.shared.tree;

import com.tengju.data.domain.model.user.UserIdCode;
import com.tengju.data.domain.shared.IdObject;
import lombok.Getter;

import java.util.Objects;

@Getter
public class Member implements TreeData {

    private String name;
    private UserIdCode id;

    public Member(long id) {
        this.name = String.valueOf(id);
        this.id = new UserIdCode(id);
    }


    public IdObject getId(){
        return this.id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Member member = (Member) o;
        return Objects.equals(id, member.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }

    @Override
    public String toString() {
        return "Member{" +
                "name='" + name + '\'' +
                ", id=" + id +
                '}';
    }
}
